Skip to content

FOUR-34496 Skeleton improvement and coding agent setup - #9192

Merged
caleeli merged 5 commits into
feature/FOUR-34328from
FOUR-34496
Nov 23, 2026
Merged

caleeli merged 5 commits into
feature/FOUR-34328from
FOUR-34496

Conversation

@devmiguelangel

@devmiguelangel devmiguelangel commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Issue & Reproduction Steps

The Copy prompt panel of the Create Plugin dialog (FOUR-34495, #9189) was static: it ignored the form, never mentioned package-skeleton, installed skills interactively and did not state the requirements. Installing a plugin from an empty repository also failed with a generic error.

Solution

  • resources/js/admin/plugins/mcpSetupPrompt.js (new, pure functions): builds the prompt from the dialog values (instance URL, repository URL, plugin name derived like PluginManager::extractRepoName(), branch, Git username, profile) and lists the 4 MCP endpoints (/mcp/processes, /mcp/screens, /mcp/data-connectors, /mcp/flow-genies). It checks Git and Node (>= 22, 24 recommended) first, then installs the pm4-plugin-setup skill non-interactively and hands over to it. The Git token is never part of the prompt.
  • Plugins.vue: profile selector (PM4 only / Migration), prompt wired to the form, hints on the Install button and the token field.
  • PluginManager::validatePlugin(): when the cloned repository is empty (no commits), throws a clear message ("push the plugin skeleton first") instead of the generic one. Covered by a new test in tests/Managers/PluginManagerTest.php.
Screenshot 2026-11-23 at 9 35 27 AM

How to Test

  1. Admin > Plugins > Plugin. Fill in a repository URL, branch and username (and a token). Copy prompt / View prompt: it contains those values, the plugin name equals the repository name, the 4 MCP URLs, and does not contain the token.
  2. Click Save with an empty GitHub repository: the error says to push the skeleton first.
  3. End to end: paste the prompt into a coding agent in a folder named like the repository (needs the two related PRs merged, or the local-path override); once it pushes, Save in Admin > Plugins installs the plugin.
  4. docker exec --env-file compose/envs/app.env.testing pm4_core ./vendor/bin/phpunit --filter <test name> tests/Managers/PluginManagerTest.php (run one test per process: the whole file has pre-existing failures with the storage/plugins/package-example fixture).

Related Tickets & Packages

FOUR-34496
ProcessMaker/package-skeleton#31
#9192

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@cursor

cursor Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Focused on plugin admin UI and install error messaging; no auth or core process runtime changes.

Overview
Replaces the static Copy prompt in Create Plugin with a form-driven prompt from new mcpSetupPrompt.js: instance URL, repo/branch/username (credentials stripped from URLs), derived plugin name, PM4 only vs PM3 → PM4 migration profile, pm4-plugin-setup skill flow, and MCP endpoints—Git tokens never enter the prompt. Plugins.vue adds profile radios, empty-repo and token-privacy hints, and updated MCP panel copy.

PluginManager now detects empty clones (no HEAD) and README-only repos, failing early after clone (before branch checkout) and during validatePlugin() with EMPTY_REPOSITORY_MESSAGE instead of obscure git/composer.json errors. PHPUnit coverage for empty, placeholder-only, and rollback paths.

Reviewed by Cursor Bugbot for commit 964170c. Bugbot is set up for automated code reviews on this repo. Configure here.

@devmiguelangel
devmiguelangel removed the request for review from henryjonathanquispe November 23, 2026 14:07
@devmiguelangel devmiguelangel changed the title FOUR-34496 Coding agent setup prompt and empty repository error FOUR-34496 Skeleton improvement and coding agent setup Nov 23, 2026
@devmiguelangel devmiguelangel self-assigned this Nov 23, 2026
* Same two passes as PluginManager::redactHttpUserInfoFromString() in core: a pasted clone URL
* with credentials must never reach the prompt, the clipboard or the agent transcript.
*/
export function stripUrlUserInfo(value) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Agentic Security Review

Severity: MEDIUM

Description: stripUrlUserInfo() does not remove HTTP userinfo when the pasted clone URL has an unencoded @ in the username. The first replace requires user:password with no @ in either part, and the second replace deletes only through the first @ and does not run again. https://user@domain.com:ghp_secret@github.com/org/repo.git therefore becomes https://domain.com:[REDACTED]@github.com/org/repo.git. That residual is still a normal user:password URL (username domain.com, password ghp_secret, host github.com). buildMcpSetupPrompt() writes it to PLUGIN_REPO, and Copy prompt / View prompt publish that string.

Impact: A manage-plugins admin who pastes an email-style clone URL (a form the Repository URL field accepts) and then copies the setup prompt still puts a live git password or PAT on the clipboard and into Claude, Cursor, or another agent. The prompt is built to be pasted there, and its own rules say a git token must not enter that chat. The separate Token field is excluded; this path leaks the credential embedded in plugin.url. Git and the WHATWG URL parser both treat the leftover URL as authenticated userinfo, so the agent can reuse it.

Remediation: Parse the repository URL with the URL constructor and rebuild it with username and password cleared, repeating until both are empty. If parsing fails or the serialized URL still contains userinfo, omit PLUGIN_REPO from the prompt instead of embedding it. Do not treat the two-pass userinfo regular expression as the redaction gate.

@caleeli
caleeli merged commit 464bc3d into feature/FOUR-34328 Nov 23, 2026
10 checks passed
@decisions-sonarqube

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants